package org.hong.h11.controller;


import org.hong.h11.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.hong.h11.entity.Student;
import org.hong.h11.commom.Response;

@RestController
@RequestMapping("/student")
public class StudentController {


    @Autowired
    private StudentMapper studentMapper;
    @PostMapping("/add")
    public Response add( @RequestBody Student student) {
        int i = studentMapper.insertOne(student);
        return Response.ok(student);
    }
    @GetMapping("/all")
    public Response all() {
        return Response.ok(studentMapper.allStudents());
    }


}
